﻿<%@ Page Language="C#" AutoEventWireup="false" Inherits="Web.BasePage" validateRequest="false" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="MAF.Common" %>
<%@ Import Namespace="Web" %>
<%
if( 0<Request.Files.Count )
{
    string path = Server.MapPath(WebConf.ImagesRootPath+"/"+this.Module);
    if (!Directory.Exists(path))
    {
        Directory.CreateDirectory(path);
    }
    FileStorageStrategy fss = new DefaultFileStorageStragy(path, 100, 1000);
    HttpPostedFile file = Request.Files[0];
    Stream stream = file.InputStream;
    if (0 < stream.Length)
    {
        string[] arry = fss.Save(stream, Path.GetExtension(file.FileName));
        //file.SaveAs(@"D:\"+file.FileName);
%>
    <script type='text/javascript'>
        window.parent.jqAjaxUploadResponse("<%=arry[0]+"/"+arry[1] %>");
    </script>
<%
    }
    else
    {
%>
    <script type='text/javascript'>
        window.parent.jqAjaxUploadResponse();
    </script>
<%
    }
}
%>